home *** CD-ROM | disk | FTP | other *** search
/ Future Workshop / Future Workshop.iso / multimed / qtw111 / pviewer / pictutl.c < prev    next >
Text File  |  1993-11-01  |  23KB  |  544 lines

  1.  
  2. // ---------------------------------------------------------------------
  3. //
  4. // PictUtl.c - Picture Viewer - QuickTime for Windows
  5. //
  6. //             Version 1.0
  7. //
  8. //             (c) 1988-1992 Apple Computer, Inc. All Rights Reserved.
  9. //
  10. // ---------------------------------------------------------------------
  11.  
  12.  
  13.  
  14. // Includes
  15. // --------
  16.    #include <Windows.H>               // Required by Windows
  17.    #include <qtw.h>                   // Interface to QuickTime
  18.    #include <qtole.h>                 // Interface to qtole dll
  19.    #include <string.h>                // Standard "C"
  20.  
  21.    #include "common.h"                // Interface to common.c
  22.  
  23.    #include "viewer.h"                // Interface to other *.c files
  24.    #include "viewer.hr"               // Defines used in *.rc files
  25.    #include "picture.h"               // Interface to picture window
  26.                                       // child window processing
  27.  
  28. // Constants
  29. // ---------
  30.    #define  OPTIONSPROP   "PictOptionsProp"
  31.  
  32.  
  33. // typedefs
  34. // --------
  35.    typedef struct _tagWORKOPTIONS
  36.       {QTOLE_OPTIONSPICTURE      SaveOptions;
  37.        LPQTOLE_OPTIONSPICTURE   lpOptions;
  38.        HLOCAL                   hmem;
  39.       } WORKOPTIONS;
  40.    typedef WORKOPTIONS NEAR * NPWORKOPTIONS;
  41.  
  42.  
  43. // Exported callback functions
  44. // ----------------------------
  45.    BOOL __export CALLBACK GetOptionsDlgProc     (HWND, UINT, WPARAM, LPARAM);
  46.  
  47. // Internal Function Declarations
  48. // ------------------------------
  49.    static VOID    NEAR    SetDlgForOptions       (HWND, LPQTOLE_OPTIONSPICTURE);
  50.    static VOID    NEAR    GetCurrentDlgSettings  (HWND, LPQTOLE_OPTIONSPICTURE);
  51.    static VOID    NEAR    SaveOptionsAsDefault   (LPQTOLE_OPTIONSPICTURE);
  52.  
  53.  
  54. // Function: ViewerGetOptions - Opens the options dialog
  55. // --------------------------------------------------------------------
  56. // Parameters: HWND                    hwndParent     HWND of dialog parent
  57. //             LPQTOLE_OPTIONSPICTURE  lpOptions      -> options struct
  58. //
  59. // Returns:    LONG                    0L if OK
  60. // --------------------------------------------------------------------
  61.    BOOL FAR ViewerGetOptions( HWND hwndParent, LPQTOLE_OPTIONSPICTURE lpOptions )
  62.  
  63.      {BOOL         bChangedOptions = FALSE;
  64.       DLGPROC      lpDlgProc;
  65.  
  66.       if( lpDlgProc = (DLGPROC) MakeProcInstance
  67.                   ( (FARPROC) GetOptionsDlgProc, ViewerQueryInstance()))
  68.          {bChangedOptions = (BOOL) DialogBoxParam( ViewerQueryResources(),
  69.                                  MAKEINTRESOURCE( VIEWER_DLG_OPTIONS ),
  70.                                   hwndParent? hwndParent: GetActiveWindow(),
  71.                                                 lpDlgProc, (LPARAM) lpOptions );
  72.           FreeProcInstance( (FARPROC) lpDlgProc );
  73.  
  74.              // Null hwndParent indicates that dlg was started by qtole message
  75.              // with no open picture. In this case tell QTOle.dll that dialog has
  76.              // been closed. Must do this even if options are not changed and
  77.              // must return the same pointer to lpOptions as input argument to
  78.              // this function. When qtole opens dialog for open picture, normal
  79.              // closing will updata options
  80.           if( !hwndParent )
  81.               QTOLE_ClosedOptionsDlg( ViewerQueryOleData(),
  82.                                (LPQTOLE_OPTIONS) lpOptions, bChangedOptions );
  83.          }
  84.       else
  85.          {CommonTellUser( ViewerQueryResources(),
  86.                                  VIEWER_STRING_NOMEMORY, NULL, MB_OK );
  87.          }
  88.  
  89.       return bChangedOptions;
  90.      }
  91.  
  92.  
  93. // Function: GetOptionsDlgProc - Get options dialog proc
  94. // --------------------------------------------------------------------
  95. // Parameters: As required by Microsoft Windows
  96. //
  97. // Returns:    As required by Microsoft Windows
  98. // --------------------------------------------------------------------
  99.    BOOL __export CALLBACK GetOptionsDlgProc
  100.                 ( HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam )
  101.  
  102.      {NPWORKOPTIONS           pwoWorkOptions;
  103.       HLOCAL                  hmem;
  104.       BOOL                    bOptionsChanged;
  105.       BOOL                    bChecked;
  106.       LPQTOLE_OPTIONSPICTURE  lpOptions;
  107.  
  108.  
  109.       switch( message )
  110.          {case WM_INITDIALOG:
  111.              lpOptions = (LPQTOLE_OPTIONSPICTURE) lParam;
  112.  
  113.              hmem = LocalAlloc( LHND, sizeof( WORKOPTIONS ));
  114.              pwoWorkOptions = (NPWORKOPTIONS) LocalLock( hmem );
  115.              pwoWorkOptions->hmem = hmem;
  116.              pwoWorkOptions->SaveOptions = *lpOptions;
  117.              pwoWorkOptions->lpOptions   = lpOptions;
  118.  
  119.              SetProp( hdlg, OPTIONSPROP, (HANDLE) pwoWorkOptions );
  120.  
  121.              SetDlgForOptions( hdlg, pwoWorkOptions->lpOptions );
  122.  
  123.              SetDlgItemText( hdlg, EDIT_OPTIONS_CAPTION,
  124.                                     pwoWorkOptions->lpOptions->szCaption );
  125.              return TRUE;
  126.  
  127.           case WM_COMMAND:
  128.              switch( wParam  )
  129.                 {case IDOK:
  130.                      pwoWorkOptions = (NPWORKOPTIONS) GetProp( hdlg, OPTIONSPROP );
  131.                      GetCurrentDlgSettings( hdlg, pwoWorkOptions->lpOptions );
  132.  
  133.                      bOptionsChanged
  134.                          = (_fmemcmp( pwoWorkOptions->lpOptions,
  135.                                        &pwoWorkOptions->SaveOptions,
  136.                                          sizeof( QTOLE_OPTIONSPICTURE )) != 0 );
  137.  
  138.                      hmem = pwoWorkOptions->hmem;
  139.                      LocalUnlock( hmem );
  140.                      LocalFree( hmem );
  141.                      RemoveProp( hdlg, OPTIONSPROP );
  142.  
  143.                      EndDialog( hdlg, bOptionsChanged );
  144.                      return TRUE;
  145.  
  146.                  case IDCANCEL:
  147.                      pwoWorkOptions = (NPWORKOPTIONS) GetProp( hdlg, OPTIONSPROP );
  148.                      hmem = pwoWorkOptions->hmem;
  149.                      LocalUnlock( hmem );
  150.                      LocalFree( hmem );
  151.                      RemoveProp( hdlg, OPTIONSPROP );
  152.  
  153.                      EndDialog( hdlg, FALSE  );
  154.                      return TRUE;
  155.  
  156.                  case EDIT_OPTIONS_SHOWPC:
  157.                      bChecked = IsDlgButtonChecked( hdlg, EDIT_OPTIONS_SHOWPC );
  158.                      EnableWindow( GetDlgItem( hdlg, EDIT_OPTIONS_CAPTION_TEXT ),
  159.                                                                         bChecked );
  160.                      EnableWindow( GetDlgItem( hdlg, EDIT_OPTIONS_CAPTION ),
  161.                                                                         bChecked );
  162.                      return TRUE;
  163.  
  164.                  case EDIT_OPTIONS_COPYICON:
  165.                      bChecked = IsDlgButtonChecked( hdlg, EDIT_OPTIONS_COPYICON );
  166.                      EnableWindow( GetDlgItem( hdlg,
  167.                                            EDIT_OPTIONS_SHOWTITLEBAR ), bChecked );
  168.                      if( !bChecked )
  169.                          CheckDlgButton( hdlg, EDIT_OPTIONS_SHOWTITLEBAR, TRUE );
  170.                      return TRUE;
  171.  
  172.                  case EDIT_OPTIONS_SAVEASDEF:
  173.                      pwoWorkOptions = (NPWORKOPTIONS) GetProp( hdlg, OPTIONSPROP );
  174.                      GetCurrentDlgSettings( hdlg, pwoWorkOptions->lpOptions );
  175.                      SaveOptionsAsDefault( pwoWorkOptions->lpOptions );
  176.                      return TRUE;
  177.  
  178.                  case EDIT_OPTIONS_RESTRDEF:
  179.                      pwoWorkOptions = (NPWORKOPTIONS) GetProp( hdlg, OPTIONSPROP );
  180.                      ViewerGetDefaultOptions( pwoWorkOptions->lpOptions );
  181.                      SetDlgForOptions( hdlg, pwoWorkOptions->lpOptions );
  182.                      return FALSE;
  183.  
  184.                  default:
  185.                      return FALSE;
  186.                 }
  187.              return TRUE;
  188.  
  189.           default:
  190.              return FALSE;
  191.          }
  192.  
  193.       return FALSE;
  194.      }
  195.  
  196.  
  197. // Function: QTOLEServerCallBack - Server callback used by qtole.dll to
  198. //                                 send commands to the server
  199. // --------------------------------------------------------------------
  200. // Parameters: UINT                      uMessage
  201. //             WPARAM                    wParam
  202. //             LPARAM                    lParam
  203. //             LPQTOLE_OPTIONSPICTURE    lpOptions
  204. //
  205. //
  206. // Returns:    QTOLE_ERR        QTOLE_OK if OK
  207. // --------------------------------------------------------------------
  208.    QTOLE_ERR __export CALLBACK QTOLEServerCallBack
  209.                       ( UINT uMessage, WPARAM wParam, LPARAM lParam,
  210.                                             LPQTOLE_OPTIONSPICTURE lpOptions )
  211.  
  212.      {HWND           hwndPicture;
  213.       NPPICTUREDATA  pPictureData;
  214.       RECT           rcPicture;
  215.       RECT           rcClient;
  216.       RECT           rcIntersect;
  217.  
  218.  
  219.       switch( uMessage )
  220.          {case QTOLE_MSG_OPENOBJECT:
  221.                  // Open a picture window
  222.               SendMessage( ViewerQueryFrameWindow(),
  223.                                             WM_VIEWER_CMDLINE, 0, lParam );
  224.               hwndPicture = (HWND) SendMessage( ViewerQueryClientWindow(),
  225.                                                      WM_MDIGETACTIVE, 0, 0L );
  226.  
  227.               if( hwndPicture &&
  228.                        ( pPictureData = (NPPICTUREDATA) GetWindowWord( hwndPicture, 0 )))
  229.                  {pPictureData->qtoleOptions = *lpOptions;
  230.                   pPictureData->qtoleOptions.hwndObject = hwndPicture;
  231.                   pPictureData->qtoleOptions.phPicture  = pPictureData->phPicture;
  232.                   UpdatePictForOptions( hwndPicture, pPictureData, TRUE );
  233.                  }
  234.  
  235.               break;
  236.  
  237.           case QTOLE_MSG_SHOWOBJECT:
  238.               hwndPicture = (HWND) wParam;
  239.  
  240.               ShowWindow( ViewerQueryFrameWindow(), SW_SHOWNORMAL );
  241.  
  242.               GetWindowRect( hwndPicture, &rcPicture );
  243.               MapWindowPoints( HWND_DESKTOP,
  244.                              ViewerQueryClientWindow(), (LPPOINT) &rcPicture, 2 );
  245.               GetClientRect( ViewerQueryClientWindow(), &rcClient );
  246.               if( !IntersectRect( &rcIntersect, &rcClient, &rcPicture ))
  247.                  {MoveWindow( hwndPicture, 0, 0,
  248.                                          rcPicture.right - rcPicture.left,
  249.                                          rcPicture.bottom - rcPicture.top, TRUE );
  250.                  }
  251.  
  252.               SendMessage( ViewerQueryClientWindow(),
  253.                                              WM_MDIACTIVATE, wParam, 0L );
  254.  
  255.               if( pPictureData = (NPPICTUREDATA) GetWindowWord( hwndPicture, 0 ))
  256.                  {pPictureData->qtoleOptions = *lpOptions;
  257.                   pPictureData->qtoleOptions.hwndObject = hwndPicture;
  258.                   pPictureData->qtoleOptions.phPicture  = pPictureData->phPicture;
  259.                   UpdatePictForOptions( hwndPicture, pPictureData, TRUE );
  260.                  }
  261.  
  262.               break;
  263.  
  264.           case QTOLE_MSG_OPENOPTIONSDLG:
  265.              // Post message because we are not allowed to open a dialog
  266.              // inside an OLE method, in this case DoVerb which sends this message.
  267.              // In fact, opening the dialog directly seems to work but this
  268.              // is probably just lucky coincidence and can't be counted on.
  269.              // If wParam == hwndPicture is NULL, post to frame wnd because we don't
  270.              // open a movie wnd. If wParam != NULL, post message to hwndPicture to
  271.              // open the dialog
  272.  
  273.               if( NULL != ( hwndPicture = (HWND) wParam ))
  274.                  {PostMessage( hwndPicture, WM_COMMAND, VIEWER_EDIT_OPTIONS, 0L );
  275.                  }
  276.               else
  277.                  {PostMessage( ViewerQueryFrameWindow(),
  278.                                  WM_VIEWER_OLE_OPTIONSDLG, 0, (LPARAM) lpOptions );
  279.                  }
  280.  
  281.               break;
  282.  
  283.           case QTOLE_MSG_PLAYOBJECT:
  284.               PostMessage( ViewerQueryFrameWindow(),
  285.                                          WM_VIEWER_OLE_PLAYOBJECT, 0, lParam );
  286.               break;
  287.  
  288.           case QTOLE_MSG_FILEOPEN:
  289.               PostMessage( ViewerQueryFrameWindow(),
  290.                                            WM_COMMAND, VIEWER_FILE_OPEN, 0L );
  291.               break;
  292.  
  293.           default:
  294.               return QTOLE_GEN_ERROR;
  295.          }
  296.  
  297.       return QTOLE_OK;
  298.      }
  299.  
  300.  
  301. // Function: ViewerGetDefaultOptions - Gets the default options
  302. // --------------------------------------------------------------------
  303. // Parameters: LPQTOLE_OPTIONSPICTURE      lpOptions
  304. //
  305. // Returns:    VOID
  306. // --------------------------------------------------------------------
  307.    VOID FAR ViewerGetDefaultOptions( LPQTOLE_OPTIONSPICTURE lpOptions )
  308.  
  309.      {char      szSection[32];
  310.       char      szEntry[64];
  311.  
  312.      // Initial defaults
  313.    #define SHOWPC_DEF         TRUE
  314.    #define DRAWFRAME_DEF      TRUE
  315.    #define USEPALETTE_DEF     TRUE
  316.    #define COPYICON_DEF       FALSE
  317.    #define SHOWTITLE_DEF      TRUE
  318.    #define ZOOMHALF_DEF       FALSE
  319.    #define ZOOMNORMAL_DEF     TRUE
  320.    #define ZOOMDOUBLE_DEF     FALSE
  321.  
  322.       LoadString( ViewerQueryResources(),
  323.                     VIEWER_STRING_OPTIONS_NAME, szSection, sizeof( szSection ));
  324.  
  325.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  326.                     VIEWER_STRING_OPTIONS_SHOWPC, szEntry, sizeof( szEntry )))
  327.           lpOptions->bShowPictureControls = SHOWPC_DEF;
  328.       else
  329.           lpOptions->bShowPictureControls = (BOOL)
  330.                    GetPrivateProfileInt( szSection, szEntry, SHOWPC_DEF, QTW_PROFILE );
  331.  
  332.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  333.                       VIEWER_STRING_OPTIONS_DRAWFRAME, szEntry, sizeof( szEntry )))
  334.           lpOptions->bDrawWindowFrame = DRAWFRAME_DEF;
  335.       else
  336.           lpOptions->bDrawWindowFrame = (BOOL)
  337.                 GetPrivateProfileInt( szSection, szEntry, DRAWFRAME_DEF, QTW_PROFILE );
  338.  
  339.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  340.                     VIEWER_STRING_OPTIONS_USEPALETTE, szEntry, sizeof( szEntry )))
  341.           lpOptions->bUsePicturePalette = USEPALETTE_DEF;
  342.       else
  343.           lpOptions->bUsePicturePalette = (BOOL)
  344.                GetPrivateProfileInt( szSection, szEntry, USEPALETTE_DEF, QTW_PROFILE );
  345.  
  346.  
  347.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  348.                     VIEWER_STRING_OPTIONS_COPYICON, szEntry, sizeof( szEntry )))
  349.           lpOptions->bCopyIcon = COPYICON_DEF;
  350.       else
  351.           lpOptions->bCopyIcon = (BOOL)
  352.                  GetPrivateProfileInt( szSection, szEntry, COPYICON_DEF, QTW_PROFILE );
  353.  
  354.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  355.                     VIEWER_STRING_OPTIONS_SHOWTITLE, szEntry, sizeof( szEntry )))
  356.           lpOptions->bShowTitleBar = SHOWTITLE_DEF;
  357.       else
  358.           lpOptions->bShowTitleBar = (BOOL)
  359.                 GetPrivateProfileInt( szSection, szEntry, SHOWTITLE_DEF, QTW_PROFILE );
  360.  
  361.  
  362.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  363.                    VIEWER_STRING_OPTIONS_ZOOMHALF, szEntry, sizeof( szEntry )))
  364.           lpOptions->bZoomHalf = ZOOMHALF_DEF;
  365.       else
  366.           lpOptions->bZoomHalf = (BOOL)
  367.                 GetPrivateProfileInt( szSection, szEntry, ZOOMHALF_DEF, QTW_PROFILE );
  368.  
  369.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  370.                    VIEWER_STRING_OPTIONS_ZOOMNORMAL, szEntry, sizeof( szEntry )))
  371.           lpOptions->bZoomNormal = ZOOMNORMAL_DEF;
  372.       else
  373.           lpOptions->bZoomNormal = (BOOL)
  374.                GetPrivateProfileInt( szSection, szEntry, ZOOMNORMAL_DEF, QTW_PROFILE );
  375.  
  376.       if( !szSection[0] || !LoadString( ViewerQueryResources(),
  377.                    VIEWER_STRING_OPTIONS_ZOOMDOUBLE, szEntry, sizeof( szEntry )))
  378.           lpOptions->bZoomDouble = ZOOMDOUBLE_DEF;
  379.       else
  380.           lpOptions->bZoomDouble = (BOOL)
  381.                GetPrivateProfileInt( szSection, szEntry, ZOOMDOUBLE_DEF, QTW_PROFILE );
  382.  
  383.          // Now make sure no more than one option is on
  384.          // Give priority to normal
  385.       if( lpOptions->bZoomNormal )
  386.          {lpOptions->bZoomHalf   = FALSE;
  387.           lpOptions->bZoomDouble = FALSE;
  388.          }
  389.       else if( lpOptions->bZoomDouble )
  390.          {lpOptions->bZoomHalf = FALSE;
  391.          }
  392.  
  393.       return;
  394.      }
  395.  
  396.  
  397. // Function: SaveOptionsAsDefault - Caches the current options as the defaults
  398. //                                  in qtw.ini
  399. // --------------------------------------------------------------------
  400. // Parameters: LPQTOLE_OPTIONSPICTURE      lpOptions
  401. //
  402. // Returns:    VOID
  403. // --------------------------------------------------------------------
  404.    static VOID NEAR SaveOptionsAsDefault( LPQTOLE_OPTIONSPICTURE lpOptions )
  405.  
  406.      {char      szSection[32];
  407.       char      szEntry[64];
  408.  
  409.   #define szONE     "1"
  410.   #define szZERO    "0"
  411.  
  412.       if( !LoadString( ViewerQueryResources(),
  413.                     VIEWER_STRING_OPTIONS_NAME, szSection, sizeof( szSection )))
  414.           return;
  415.  
  416.       if( LoadString( ViewerQueryResources(),
  417.                     VIEWER_STRING_OPTIONS_SHOWPC, szEntry, sizeof( szEntry )))
  418.           WritePrivateProfileString( szSection, szEntry,
  419.                     lpOptions->bShowPictureControls? szONE: szZERO, QTW_PROFILE );
  420.  
  421.       if( LoadString( ViewerQueryResources(),
  422.                     VIEWER_STRING_OPTIONS_DRAWFRAME, szEntry, sizeof( szEntry )))
  423.           WritePrivateProfileString( szSection, szEntry,
  424.                          lpOptions->bDrawWindowFrame? szONE: szZERO, QTW_PROFILE );
  425.  
  426.       if( LoadString( ViewerQueryResources(),
  427.                     VIEWER_STRING_OPTIONS_USEPALETTE, szEntry, sizeof( szEntry )))
  428.           WritePrivateProfileString( szSection, szEntry,
  429.                          lpOptions->bUsePicturePalette? szONE: szZERO, QTW_PROFILE );
  430.  
  431.       if( LoadString( ViewerQueryResources(),
  432.                     VIEWER_STRING_OPTIONS_COPYICON, szEntry, sizeof( szEntry )))
  433.           WritePrivateProfileString( szSection, szEntry,
  434.                            lpOptions->bCopyIcon? szONE: szZERO, QTW_PROFILE );
  435.  
  436.       if( LoadString( ViewerQueryResources(),
  437.                     VIEWER_STRING_OPTIONS_SHOWTITLE, szEntry, sizeof( szEntry )))
  438.           WritePrivateProfileString( szSection, szEntry,
  439.                            lpOptions->bShowTitleBar? szONE: szZERO, QTW_PROFILE );
  440.  
  441.       if( LoadString( ViewerQueryResources(),
  442.                    VIEWER_STRING_OPTIONS_ZOOMHALF, szEntry, sizeof( szEntry )))
  443.           WritePrivateProfileString( szSection, szEntry,
  444.                             lpOptions->bZoomHalf? szONE: szZERO, QTW_PROFILE );
  445.  
  446.       if( LoadString( ViewerQueryResources(),
  447.                    VIEWER_STRING_OPTIONS_ZOOMNORMAL, szEntry, sizeof( szEntry )))
  448.           WritePrivateProfileString( szSection, szEntry,
  449.                            lpOptions->bZoomNormal? szONE: szZERO, QTW_PROFILE );
  450.  
  451.       if( LoadString( ViewerQueryResources(),
  452.                    VIEWER_STRING_OPTIONS_ZOOMDOUBLE, szEntry, sizeof( szEntry )))
  453.           WritePrivateProfileString( szSection, szEntry,
  454.                            lpOptions->bZoomDouble? szONE: szZERO, QTW_PROFILE );
  455.  
  456.       return;
  457.      }
  458.  
  459.  
  460. // Function: SetDlgForOptions - Sets the options dialog controls according
  461. //                              to current options
  462. // --------------------------------------------------------------------
  463. // Parameters: HWND                      hdlg
  464. //             LPQTOLE_OPTIONSPICTURE    lpOptions
  465. //
  466. //
  467. // Returns:    VOID
  468. // --------------------------------------------------------------------
  469.    static VOID NEAR SetDlgForOptions( HWND hdlg, LPQTOLE_OPTIONSPICTURE lpOptions )
  470.  
  471.      {int       idButton;
  472.  
  473.       CheckDlgButton( hdlg, EDIT_OPTIONS_SHOWPC,
  474.                                          lpOptions->bShowPictureControls );
  475.  
  476.       EnableWindow( GetDlgItem( hdlg, EDIT_OPTIONS_CAPTION_TEXT ),
  477.                                          lpOptions->bShowPictureControls );
  478.       EnableWindow( GetDlgItem( hdlg, EDIT_OPTIONS_CAPTION ),
  479.                                          lpOptions->bShowPictureControls );
  480.  
  481.       CheckDlgButton( hdlg, EDIT_OPTIONS_DRAWFRAME,
  482.                                          lpOptions->bDrawWindowFrame );
  483.       CheckDlgButton( hdlg, EDIT_OPTIONS_USEPALETTE,
  484.                                          lpOptions->bUsePicturePalette );
  485.  
  486.       CheckDlgButton( hdlg, EDIT_OPTIONS_COPYICON,
  487.                                          lpOptions->bCopyIcon );
  488.       CheckDlgButton( hdlg, EDIT_OPTIONS_SHOWTITLEBAR,
  489.                                          lpOptions->bShowTitleBar );
  490.       if( !lpOptions->bCopyIcon )
  491.           EnableWindow( GetDlgItem( hdlg, EDIT_OPTIONS_SHOWTITLEBAR ), FALSE );
  492.  
  493.  
  494.       if( lpOptions->bZoomHalf )
  495.           idButton = EDIT_OPTIONS_ZOOMHALF;
  496.       else if( lpOptions->bZoomNormal )
  497.           idButton = EDIT_OPTIONS_ZOOMNORMAL;
  498.       else if( lpOptions->bZoomDouble )
  499.           idButton = EDIT_OPTIONS_ZOOMDOUBLE;
  500.       else
  501.           idButton = EDIT_OPTIONS_ZOOMCURRENT;
  502.  
  503.       CheckRadioButton( hdlg, EDIT_OPTIONS_ZOOMCURRENT,
  504.                                    EDIT_OPTIONS_ZOOMDOUBLE, idButton );
  505.  
  506.       return;
  507.      }
  508.  
  509. // Function: GetCurrentDlgSettings - Fills the options struct with the current state
  510. //                                   of the dialog controls
  511. // --------------------------------------------------------------------
  512. // Parameters: HWND                      hdlg
  513. //             LPQTOLE_OPTIONSPICTURE    lpOptions
  514. //
  515. //
  516. // Returns:    VOID
  517. // --------------------------------------------------------------------
  518.    static VOID NEAR GetCurrentDlgSettings
  519.                               ( HWND hdlg, LPQTOLE_OPTIONSPICTURE lpOptions )
  520.  
  521.      {lpOptions->bShowPictureControls =
  522.                              IsDlgButtonChecked( hdlg, EDIT_OPTIONS_SHOWPC );
  523.       GetDlgItemText( hdlg, EDIT_OPTIONS_CAPTION,
  524.                                        lpOptions->szCaption, MAX_TEXT_LEN );
  525.  
  526.       lpOptions->bDrawWindowFrame =
  527.                             IsDlgButtonChecked( hdlg, EDIT_OPTIONS_DRAWFRAME );
  528.       lpOptions->bUsePicturePalette =
  529.                             IsDlgButtonChecked( hdlg, EDIT_OPTIONS_USEPALETTE );
  530.  
  531.       lpOptions->bCopyIcon = IsDlgButtonChecked( hdlg, EDIT_OPTIONS_COPYICON );
  532.  
  533.       lpOptions->bShowTitleBar =
  534.                       IsDlgButtonChecked( hdlg, EDIT_OPTIONS_SHOWTITLEBAR );
  535.  
  536.       lpOptions->bZoomHalf   = IsDlgButtonChecked( hdlg, EDIT_OPTIONS_ZOOMHALF );
  537.       lpOptions->bZoomNormal = IsDlgButtonChecked( hdlg, EDIT_OPTIONS_ZOOMNORMAL );
  538.       lpOptions->bZoomDouble = IsDlgButtonChecked( hdlg, EDIT_OPTIONS_ZOOMDOUBLE );
  539.  
  540.       return;
  541.      }
  542.  
  543.  
  544.